Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Example] Dispatch domain events for albums #95

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

luca-rath
Copy link
Contributor

@luca-rath luca-rath commented May 28, 2021

What's in this PR?

This pull request shows, how to dispatch domain events for custom entities and show them in the administration interface in a separate tab on the edit view of your custom entity.

image

Requirements

Sulu >= 2.3.1

@luca-rath luca-rath added the Example Example implementations label May 28, 2021
@luca-rath luca-rath force-pushed the example/album-domain-events branch 3 times, most recently from b1fe906 to e5f2299 Compare June 1, 2021 08:02
"app.select_album": "Select album",
"sulu_activity.description.albums.created": "{userFullName} has created the album \"{resourceTitle}\"",
"sulu_activity.description.albums.modified": "{userFullName} has changed the album \"{resourceTitle}\"",
"sulu_activity.description.albums.removed": "{userFullName} has removed the album \"{resourceTitle}\""
Copy link
Contributor Author

@luca-rath luca-rath Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These translation keys consist of sulu_activity.description as fixed part, the resourceKey (albums) and the eventType (removed).

The available translation parameters can be found here.

To use variables of the context, you have to use context_myVar.


public function getEventPayload(): ?array
{
return $this->payload;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By configuring sulu_activity.storage.persist_payload to true in config/packages/sulu_activity.yaml, the event payload will be persisted in the database too.

@luca-rath luca-rath force-pushed the example/album-domain-events branch from e5f2299 to ed3253d Compare June 22, 2021 13:02
@TheCadien
Copy link
Member

think a good hint for that example is, that you need Sulu 2.3.4.
The ActivityViewBuilderFactoryInterface inst implemented by Sulu 2.3.0

@luca-rath
Copy link
Contributor Author

think a good hint for that example is, that you need Sulu 2.3.4.
The ActivityViewBuilderFactoryInterface inst implemented by Sulu 2.3.0

Yes, good hint, but the ActivityViewBuilderFactoryInterface exists since Sulu 2.3.1, not 2.3.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Example Example implementations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants